//
//  main.cpp
//  Dungeons and Princesses
//
//  Created by John Grange on 10/6/11.
//  Copyright (c) 2011 SD Networks. All rights reserved.
//  Updated - Added stub code from rivers test class to genreate working game.
//  Updated - 20111015 3:59PM - Removed run loop from this function, will be moved into Game class.
//  

#include "Game.h"
#include "Base.h"
#ifdef __APPLE__
#include "CoreFoundation/CoreFoundation.h"
#endif

using namespace std;


int main (int argc, const char * argv[])
{

    // ----------------------------------------------------------------------------
        // This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle
#ifdef __APPLE__
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
    char path[PATH_MAX];
    if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
    {
        // error!
    }
    CFRelease(resourcesURL);

    chdir(path);
#endif
        // ----------------------------------------------------------------------------

    // Intiialize counter
    //Base::next_ID = 1000;
    Game *newGame = new Game;

    newGame->run();

    return 0;
}

